<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
     <input type="text" name="" id="inp1">
     <button id="but" >确认</button>
</body>
</html>
<script>
    var inp1 = document.getElementById('inp1')
    var but = document.getElementById('but')
    but.onclick = function(){
        var aa = ''
        var bb = ''
      var kk = prompt('请输入第二个值') 
      if(inp1.value % 2 == 0){
         aa = 1
      }else{
          aa = 0
      }
      if(kk % 2 == 0){
          bb = 1
      }else{
          bb = 0
      }
      console.log(aa);
      console.log(bb);
      if(aa == 1 && bb == 1){
          alert('两个数都是偶数')
      }
      if(aa == 0 && bb == 0){
          alert('两个数都是奇数')
      }
      if(aa == bb){
          alert('两个数奇偶性一致')
      }
      if(aa != bb){
          alert('两个数奇偶性不一致')
      }
    }

</script>